<template>
	<view class="appoint" ref="container">
		<view style="width: 100%;position: fixed;top: 0;left: 0;z-index: 999;height: 50rpx;line-height: 50rpx;background: #fff;font-size: 24rpx;text-align: center;color: #E93323;">
			*由于多规格属性复杂目前手机端仅支持单规格商品添加编辑
		</view>
		<form class="appoint" @submit="formSubmit">
			<view class="app_index" style="margin-top: 70rpx;">
				<view class="item">
					<view class="label">商品名称<text style="color: red;">*</text></view>
					<view class="value">
						<input :value="productInfo.store_name" name="store_name" maxlength="30" placeholder="请输入商品名称" style="margin-top: 24rpx;"></input>
					</view>
				</view>
				<view class="item">
					<view class="label">单位<text style="color: red;">*</text></view>
					<view class="value">
						<input :value="productInfo.unit_name" name="unit_name" maxlength="5" placeholder="请输入单位" style="margin-top: 24rpx;"></input>
					</view>
				</view>
				<view class="item">
					<view class="label">关键字</view>
					<view class="value">
						<input :value="productInfo.keyword" name="keyword" maxlength="30" placeholder="请输入关键字" style="margin-top: 24rpx;"></input>
					</view>
				</view>
				<view class="item">
					<view class="label">店铺推荐</view>
					<view class="value">
						<switch :checked="productInfo.is_good" color="#e93323" @change="isGoodChange" style="transform: scale(0.7);"/>
					</view>
				</view>
			</view>
			<view class="app_index">
				<view class="item">
					<view class="label">平台分类<text style="color: red;">*</text></view>
					<view class="value">
						<view v-if="platCateResult.result" @tap="platCateResult.visible = true">{{platCateResult.result}}</view>
						<view wx:else style="color: #808080;" @tap="platCateResult.visible = true">请选择平台分类</view>
						<text class='iconfont icon-jiantou' style="position: absolute;top: 2rpx;right: 2rpx;padding: 0;"></text>
					</view>
				</view>
				<view class="item">
					<view class="label">商户分类<text style="color: red;">*</text></view>
					<view class="value">
						<ld-select :multiple="true" :list="merCate" listKey="label" valueKey="value" placeholder="请选择商户分类" v-model="mer_cate_id"
						 @change="merCateChange">
						</ld-select>
						<text class='iconfont icon-jiantou' style="position: absolute;top: 2rpx;right: 2rpx;padding: 0;"></text>
					</view>
				</view>
				<view class="item">
					<view class="label">品牌选择<text style="color: red;">*</text></view>
					<view class="value">
						<view v-if="brandResult.result" @tap="brandResult.visible = true">{{brandResult.result}}</view>
						<view wx:else style="color: #808080;" @tap="brandResult.visible = true">请选择品牌</view>
						<text class='iconfont icon-jiantou' style="position: absolute;top: 2rpx;right: 2rpx;padding: 0;"></text>
					</view>
				</view>
				<view class="item">
					<view class="label">运费模板<text style="color: red;">*</text></view>
					<view class="value">
						<view v-if="shipResult.result" @tap="shipResult.visible = true">{{shipResult.result}}</view>
						<view wx:else style="color: #808080;" @tap="shipResult.visible = true">请选择运费模板</view>
						<text class='iconfont icon-jiantou' style="position: absolute;top: 2rpx;right: 2rpx;padding: 0;"></text>
					</view>
				</view>
			</view>
			<view class="app_index">
				<view class="item">
					<view class="label">售价<text style="color: red;">*</text></view>
					<view class="value">
						<input type="digit" :value="productInfo.attrValue[0].price" name="price" maxlength="10" placeholder="请输入商品售价" style="margin-top: 24rpx;"></input>
					</view>
				</view>
				<view class="item">
					<view class="label">成本价</view>
					<view class="value">
						<input type="digit" :value="productInfo.attrValue[0].cost" name="cost" maxlength="10" placeholder="请输入商品成本价" style="margin-top: 24rpx;"></input>
					</view>
				</view>
				<view class="item">
					<view class="label">原价<text style="color: red;">*</text></view>
					<view class="value">
						<input type="digit" :value="productInfo.attrValue[0].ot_price" name="ot_price" maxlength="10" placeholder="请输入商品原价" style="margin-top: 24rpx;"></input>
					</view>
				</view>
				<view class="item">
					<view class="label">库存<text style="color: red;">*</text></view>
					<view class="value">
						<input type="number" :value="productInfo.attrValue[0].stock" name="stock" maxlength="10" placeholder="请输入商品库存" style="margin-top: 24rpx;"></input>
					</view>
				</view>
				<view class="item">
					<view class="label">商品编码</view>
					<view class="value">
						<input type="number" :value="productInfo.attrValue[0].bar_code" name="bar_code" maxlength="10" placeholder="请输入商品编码" style="margin-top: 24rpx;"></input>
					</view>
				</view>
				<view class="item">
					<view class="label">重量(KG)</view>
					<view class="value">
						<input type="digit" :value="productInfo.attrValue[0].weight" name="weight" maxlength="10" placeholder="请输入商品重量" style="margin-top: 24rpx;"></input>
					</view>
				</view>
				<view class="item">
					<view class="label">体积(m³)</view>
					<view class="value">
						<input type="digit" :value="productInfo.attrValue[0].volume" name="volume" maxlength="10" placeholder="请输入商品体积" style="margin-top: 24rpx;"></input>
					</view>
				</view>
			</view>
			<view class="app_index">
				<view class="font-color" style="font-size: 24rpx;margin: 20rpx 0 0 20rpx;">*不设置或都为0则使用系统默认佣金设置</view>
				<view class="item">
					<view class="label">一级返佣(元)</view>
					<view class="value">
						<input type="digit" :value="productInfo.attrValue[0].extension_one" name="extension_one" maxlength="10" placeholder="请输入一级返佣金额" style="margin-top: 24rpx;"></input>
					</view>
				</view>
				<view class="item">
					<view class="label">二级返佣(元)</view>
					<view class="value">
						<input type="digit" :value="productInfo.attrValue[0].extension_two" name="extension_two" maxlength="10" placeholder="请输入二级返佣金额" style="margin-top: 24rpx;"></input>
					</view>
				</view>
			</view>
			<view class="app_index">
				<view class="item" style="height: 100%;line-height: 40rpx;">
					<view class="label" style="line-height: 100rpx;float: none;width: 100%;">封面图<text style="color: red;">*</text></view>
					<view v-if="productInfo.image" @click='uploadimg' style="width: 156rpx;height: 156rpx;border: 1px solid #e0e0e0;position: relative;display: inline-block;margin-right: 10rpx;">
						<image :src="productInfo.image" mode="aspectFill" style="max-width: 100%;max-height: 100%;"></image>
					</view>
					<view v-if="!productInfo.image" @click='uploadimg' style="width: 156rpx;height: 156rpx;border: 1px solid #e0e0e0;position: relative;display: inline-block;">
						<text class='iconfont icon-icon25201' style="position: absolute;top: 52rpx;right: 46rpx;font-size: 60rpx;padding: 8rpx;"></text>
					</view>
				</view>
				<view class="item" style="height: 100%;line-height: 40rpx;">
					<view class="label" style="line-height: 100rpx;float: none;width: 100%;">轮播图<text style="color: red;">*</text><view style="float: right;">{{productInfo.slider_image.length || 0}}/4</view>
					</view>
					<view v-for="(item, index) in productInfo.slider_image" :key='index' style="width: 156rpx;height: 156rpx;border: 1px solid #e0e0e0;position: relative;display: inline-block;margin-right: 10rpx;">
						<image :src="item" mode="aspectFill" style="max-width: 100%;max-height: 100%;"></image>
						<text @click='DelPic(index)' style="padding: 0 10rpx;color: #fff;background: #333;position: absolute;top: 0;right: 0;">×</text>
					</view>
					<view v-if="productInfo.slider_image.length < 4" @click='uploadpic' style="width: 156rpx;height: 156rpx;border: 1px solid #e0e0e0;position: relative;display: inline-block;">
						<text class='iconfont icon-icon25201' style="position: absolute;top: 52rpx;right: 46rpx;font-size: 60rpx;padding: 8rpx;"></text>
					</view>
				</view>
				<view class="item" style="height: 100%;line-height: 40rpx;">
					<view class="label" style="line-height: 100rpx;">商品简介<text style="color: red;">*</text></view>
					<textarea :value="productInfo.store_info" name="store_info" maxlength="150" placeholder="请输入商品简介" style="width: 100%;height: 120rpx;border: 1px solid #f2f2f2;" />
				</view>
				<view class="item" style="height: 100%;line-height: 40rpx;">
					<view class="label" style="line-height: 100rpx;float: none;">商品详情</view>
					<editor id="editor" style="height: 800rpx;" placeholder="请输入" @ready="onEditorReady" @input="onEditorInput" @statuschange="onStatusChange"></editor>
					<view class='ql-toolbar acea-row row-between-wrapper' @tap="format">
						<!-- 字体加粗 -->
						<view :class="formats.bold ? 'font-color' : ''" class="iconfont icon-zitijiacu" data-name="bold"></view>
						<!-- 字体斜体 -->
						<view :class="formats.italic ? 'font-color' : ''" class="iconfont icon-zitixieti" data-name="italic"></view>
						<!-- 字体下划线 -->
						<view :class="formats.underline ? 'font-color' : ''" class="iconfont icon-zitixiahuaxian" data-name="underline"></view>
						<!-- 插入图片-->
						<view class="iconfont icon-charutupian" @tap="insertImage"></view>
						<!-- 插入分隔符 -->
						<view class="iconfont icon-fengexian" @tap="insertDivider"></view>
						<!-- 撤销-->
						<view class="iconfont icon-undo" @tap="undo"></view>
						<!-- 恢复 -->
						<view class="iconfont icon-redo" @tap="redo"></view>
						<!-- 清空-->
						<view class="iconfont icon-shanchu" @tap="clear"></view>
						<!-- 字体删除线 -->
						<!-- <view :class="formats.strike ? 'font-color' : ''" class="iconfont icon-zitishanchuxian" data-name="strike"></view> -->
						<!-- 左对齐 -->
						<!-- <view :class="formats.align === 'left' ? 'font-color' : ''" class="iconfont icon-zuoduiqi" data-name="align"
						 data-value="left"></view> -->
						<!-- 居中对齐-->
						<!-- <view :class="formats.align === 'center' ? 'font-color' : ''" class="iconfont icon-juzhongduiqi" data-name="align"
						 data-value="center"></view> -->
						<!-- 右对齐-->
						<!-- <view :class="formats.align === 'right' ? 'font-color' : ''" class="iconfont icon-youduiqi" data-name="align"
						 data-value="right"></view> -->
						<!-- 左右对齐-->
						<!-- <view :class="formats.align === 'justify' ? 'font-color' : ''" class="iconfont icon-zuoyouduiqi" data-name="align"
						 data-value="justify"></view> -->
						<!-- 行高-->
						<!-- <view :class="formats.lineHeight ? 'font-color' : ''" class="iconfont icon-line-height" data-name="lineHeight"
						 data-value="2"></view> -->
						<!-- 文字间距-->
						<!-- <view :class="formats.letterSpacing ? 'font-color' : ''" class="iconfont icon-Character-Spacing" data-name="letterSpacing"
						 data-value="2em"></view> -->
						<!-- 段落前距-->
						<!-- <view :class="formats.marginTop ? 'font-color' : ''" class="iconfont icon-722bianjiqi_duanqianju" data-name="marginTop"
						 data-value="20px"></view> -->
						<!-- 段落后距-->
						<!-- <view :class="formats.previewarginBottom ? 'font-color' : ''" class="iconfont icon-723bianjiqi_duanhouju"
						 data-name="marginBottom" data-value="20px"></view> -->
						<!-- 清除格式-->
						<!-- <view class="iconfont icon-clearedformat" @tap="removeFormat"></view> -->
						<!-- 文字字体 -->
						<!-- <view :class="formats.fontFamily ? 'font-color' : ''" class="iconfont icon-font" data-name="fontFamily" data-value="Pacifico"></view> -->
						<!-- 文字大小 -->
						<!-- <view :class="formats.fontSize === '24px' ? 'font-color' : ''" class="iconfont icon-fontsize" data-name="fontSize"
						 data-value="24px"></view> -->
						<!-- 文字颜色-->
						<!-- <view :class="formats.color === '#0000ff' ? 'font-color' : ''" class="iconfont icon-text_color" data-name="color"
						 data-value="#0000ff"></view> -->
						<!-- 文字背景色-->
						<!-- <view :class="formats.backgroundColor === '#00ff00' ? 'font-color' : ''" class="iconfont icon-fontbgcolor"
						 data-name="backgroundColor" data-value="#00ff00"></view> -->
						<!-- 插入日期-->
						<!-- <view class="iconfont icon-date" @tap="insertDate"></view> -->
						<!--  列表化-->
						<!-- <view class="iconfont icon-checklist" data-name="list" data-value="check"></view> -->
						<!-- 有序排列 -->
						<!-- <view :class="formats.list === 'ordered' ? 'font-color' : ''" class="iconfont icon-youxupailie" data-name="list"
						 data-value="ordered"></view> -->
						<!-- 无序排列-->
						<!-- <view :class="formats.list === 'bullet' ? 'font-color' : ''" class="iconfont icon-wuxupailie" data-name="list"
						 data-value="bullet"></view> -->
						<!--  不缩进-->
						<!-- <view class="iconfont icon-outdent" data-name="indent" data-value="-1"></view> -->
						<!-- 缩进 -->
						<!-- <view class="iconfont icon-indent" data-name="indent" data-value="+1"></view> -->
						<!-- H1标签 -->
						<!-- <view :class="formats.header === 1 ? 'font-color' : ''" class="iconfont icon-format-header-1" data-name="header"
						 :data-value="1"></view> -->
						<!-- 字体下标-->
						<!-- <view :class="formats.script === 'sub' ? 'font-color' : ''" class="iconfont icon-zitixiabiao" data-name="script"
						 data-value="sub"></view> -->
						<!-- 字体上标-->
						<!-- <view :class="formats.script === 'super' ? 'font-color' : ''" class="iconfont icon-zitishangbiao" data-name="script"
						 data-value="super"></view> -->
						<!--  右起格式-->
						<!-- <view :class="formats.direction === 'rtl' ? 'font-color' : ''" class="iconfont icon-direction-rtl" data-name="direction"
						 data-value="rtl"></view> -->
					</view>
				</view>
			</view>
			<view style="position: fixed;left: 0;bottom: 20rpx;width: 100%;height: 80rpx;line-height: 80rpx;color: #fff;text-align: center;z-index: 9;">
				<button form-type="submit" style="width: 660rpx;margin: 0 auto;border-radius: 60rpx;color: #fff;line-height: 40px;font-size: 14px;" class="bg-color">
					提交保存
				</button>
			</view>
		</form>
		<w-picker
			:visible.sync="platCateResult.visible"
			mode="linkage"
			:value="platCateResult.default"
			:options="platCate"
			:level="3"
			default-type="value"
			@confirm="platCateChange($event)"
			ref="platCate" 
		></w-picker>
		<w-picker
			:visible.sync="brandResult.visible"
			mode="selector"
			:value="brandResult.default"
			default-type="brand_id"
			:options="brandList"
			:default-props="{'label': 'brand_name', 'value': 'brand_id'}"
			@confirm="brandChange($event)"
			ref="brand"
		></w-picker>
		<w-picker
			:visible.sync="shipResult.visible"
			mode="selector"
			:value="shipResult.default"
			default-type="shipping_template_id"
			:options="shipList"
			:default-props="{'label': 'name', 'value': 'shipping_template_id'}"
			@confirm="shipChange($event)"
			ref="ship"
		></w-picker>
	</view>
</template>

<script>
	import {
		getGoodsDetail,
		goodsEdit
	} from "@/api/admin";
	import wPicker from "@/components/w-picker/w-picker.vue";
	import ldSelect from '../static/ld-select/ld-select.vue'
	import { isMoney } from '@/utils/validate.js'
	export default {
		name: "AdminGoodsEdit",
		components:{
			wPicker,
			ldSelect
		},
		data() {
			return {
				productId: 0,
				productInfo: {
					attr: [],
					attrValue: [{
						bar_code: '',
						cost: '',
						image: '',
						ot_price: '',
						price: '',
						stock: '',
						volume: '',
						weight: '',
						extension_one: '',
						extension_two: '',
					}],
					brand_id: 0,
					cate_id: 0,
					content: '',
					couponData: [],
					extension_type: 0,
					give_coupon_ids: [],
					image: '',
					is_gift_bag: 0,
					is_good: 0,
					keyword: '',
					mer_cate_id: [],
					slider_image: [],
					sort: 0,
					spec_type: 0,
					store_info: '',
					store_name: '',
					temp_id: 0,
					unit_name: '',
				},
				platCate: [],
				merCate: [],
				brandList: [],
				shipList: [],
				platCateResult: {
					visible: false,
					default: [],
					result: '',
				},
				brandResult: {
					visible: false,
					default: 0,
					result: '',
				},
				shipResult: {
					visible: false,
					default: 0,
					result: '',
				},
				mer_cate_id: [],
				formats: {},
			};
		},
		onLoad(option) {
			if (option.id) this.productId = option.id;
			this.getGoodsDetail();
		},
		methods: {
			// 获取数据
			getGoodsDetail: function() {
				let that = this;
				getGoodsDetail(this.productId).then(
					res => {
						that.platCate = res.data.platCate;
						that.merCate = res.data.merCate;
						that.brandList = res.data.brandList;
						that.shipList = res.data.shipList;
						// 初始化选择
						if (res.data.productInfo) {
							that.productInfo = res.data.productInfo;
							// 平台分类
							for (const l of that.platCate) {
								for (const m of l.children) {
									for (const n of m.children) {
										if (n.value == that.productInfo.cate_id) {
											that.platCateResult.default = [l.value, m.value, n.value];
											that.platCateResult.result = l.label + '/' + m.label + '/' + n.label;
											break;
										}
									}
									if (that.platCateResult.result) break;
								}
								if (that.platCateResult.result) break;
							}
							// 商品品牌
							that.brandResult.default = that.productInfo.brand.brand_id;
							that.brandResult.result = that.productInfo.brand.brand_name;
							// 运费模板
							that.shipResult.default = that.productInfo.temp.shipping_template_id;
							that.shipResult.result = that.productInfo.temp.name;
							// 商户分类
							that.mer_cate_id = that.productInfo.mer_cate_id;
							// 商品详情
							if (typeof that.editorCtx != 'undefined') that.editorCtx.setContents({ html: that.productInfo.content});
						}
						// 运费模板
						if (that.shipList.length && !that.productInfo.temp_id) {
							that.productInfo.temp_id = that.shipList[0].shipping_template_id;
							that.shipResult.default = that.shipList[0].shipping_template_id;
							that.shipResult.result = that.shipList[0].name;
						}
					},
					err => {
						that.$util.Tips({ title: err });
					}
				)
			},
			platCateChange(res){
				let result = '';
				for (const v in res.obj) {
					result += result ? '/' + res.obj[v].label : res.obj[v].label;
				}
				this.platCateResult.result = result;
				this.productInfo.cate_id = res.value[res.value.length - 1];
			},
			brandChange(res){
				this.brandResult.result = res.result;
				this.productInfo.brand_id = res.obj.brand_id;
			},
			shipChange(res){
				this.shipResult.result = res.result;
				this.productInfo.temp_id = res.obj.shipping_template_id;
			},
			merCateChange(res){
				this.productInfo.mer_cate_id = res;
			},
			isGoodChange(e) {
				this.productInfo.is_good = e.target.value ? 1 : 0;
			},
			formSubmit(e){
				let that = this;
				let formData = e.detail.value;
				let productInfo = that.productInfo;
				productInfo.store_name = formData.store_name;
				productInfo.store_info = formData.store_info;
				productInfo.unit_name = formData.unit_name;
				productInfo.keyword = formData.keyword;
				productInfo.attrValue[0].price = formData.price;
				productInfo.attrValue[0].cost = formData.cost;
				productInfo.attrValue[0].ot_price = formData.ot_price;
				productInfo.attrValue[0].stock = formData.stock;
				productInfo.attrValue[0].bar_code = formData.bar_code;
				productInfo.attrValue[0].weight = formData.weight;
				productInfo.attrValue[0].volume = formData.volume;
				productInfo.attrValue[0].extension_one = parseFloat(formData.extension_one || 0);
				productInfo.attrValue[0].extension_two = parseFloat(formData.extension_two || 0);
				if (!productInfo.attrValue[0].image) productInfo.attrValue[0].image = productInfo.image;
				// 必填项
				if (!productInfo.store_name) return that.$util.Tips({ title: '请填写商品名称' });
				if (!productInfo.unit_name) return that.$util.Tips({ title: '请填写商品单位' });
				if (!productInfo.cate_id) return that.$util.Tips({ title: '请选择平台分类' });
				if (!productInfo.mer_cate_id) return that.$util.Tips({ title: '请选择商户分类' });
				if (!productInfo.brand_id) return that.$util.Tips({ title: '请选择商品品牌' });
				if (!productInfo.temp_id) return that.$util.Tips({ title: '请选择运费模板' });
				if (!productInfo.attrValue[0].price || !isMoney(productInfo.attrValue[0].price)) return that.$util.Tips({ title: '请填写商品售价' });
				if (!productInfo.attrValue[0].ot_price || !isMoney(productInfo.attrValue[0].ot_price)) return that.$util.Tips({ title: '请填写商品原价' });
				if (!productInfo.attrValue[0].stock) return that.$util.Tips({ title: '请填写商品库存' });
				if (!productInfo.image) return that.$util.Tips({ title: '请上传商品封面图' });
				if (!productInfo.slider_image.length) return that.$util.Tips({ title: '请上传商品轮播图' });
				if (!productInfo.store_info) return that.$util.Tips({ title: '请填写商品简介' });
				if (productInfo.attrValue[0].extension_one > 0 || productInfo.attrValue[0].extension_two > 0) {
					if (productInfo.attrValue[0].extension_one <= 0) that.$util.Tips({ title: '请填写一级返佣金额' });
					if (productInfo.attrValue[0].extension_two <= 0) that.$util.Tips({ title: '请填写二级返佣金额' });
					productInfo.extension_type = 1;
				} else {
					productInfo.attrValue[0].extension_one = 0;
					productInfo.attrValue[0].extension_two = 0;
				}
				goodsEdit(that.productId, productInfo).then(
					res => {
						let pages = getCurrentPages();//当前页
						let beforePage = pages[pages.length - 2];//上个页面
						// #ifdef H5
						beforePage.init()
						// #endif
						// #ifndef H5
						beforePage.$vm.init()
						// #endif
						that.$util.Tips({
							title:res.message,
							icon:'success'
						}, {tab: 3})
					},
					err => {
						that.$util.Tips({title: err});
					}
				);
			},
			DelPic(index) {
				let that = this,
					pic = this.productInfo.slider_image[index];
				that.productInfo.slider_image.splice(index, 1);
				that.$set(that, 'productInfo', that.productInfo);
			},
			uploadpic() {
				let that = this;
				that.$util.uploadImageOne('upload/image', function(res) {
					that.productInfo.slider_image.push(res.data.path);
					that.$set(that, 'productInfo', that.productInfo);
				});
			},
			uploadimg() {
				let that = this;
				that.$util.uploadImageOne('upload/image', function(res) {
					that.productInfo.image = res.data.path;
					that.productInfo.attrValue[0].image = res.data.path;
                    if (that.productInfo.slider_image.length < 1) {
                        that.productInfo.slider_image.push(res.data.path);
                    }
					that.$set(that, 'productInfo', that.productInfo);
				});
			},
			onEditorInput(e) {
				this.productInfo.content = e.detail.html;
			},
			onEditorReady() {
				let that = this;
				uni.createSelectorQuery().select('#editor').context((res) => {
					that.editorCtx = res.context;
					if (that.productId) that.editorCtx.setContents({ html: that.productInfo.content});
				}).exec();
			},
			undo() {
				this.editorCtx.undo()
			},
			redo() {
				this.editorCtx.redo()
			},
			format(e) {
				let {
					name,
					value
				} = e.target.dataset
				if (!name) return
				this.editorCtx.format(name, value)
			},
			onStatusChange(e) {
				const formats = e.detail
				this.formats = formats
			},
			insertDivider() {
				this.editorCtx.insertDivider({
					success: function() {
						console.log('insert divider success')
					}
				})
			},
			clear() {
				this.editorCtx.clear({
					success: function(res) {
						console.log("clear success")
					}
				})
			},
			removeFormat() {
				this.editorCtx.removeFormat()
			},
			insertDate() {
				const date = new Date()
				const formatDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`
				this.editorCtx.insertText({
					text: formatDate
				})
			},
			insertImage() {
				let that = this;
				that.$util.uploadImageOne('upload/image', function(res) {
					that.editorCtx.insertImage({
						src: res.data.path,
						alt: '图像',
						success: function() {
							console.log('insert image success')
						}
					})
				});
			}
		}
	}
</script>

<style>
	@import "@/static/iconfont/editor-icon.css";
	
	.appoint {
		padding-bottom: 130rpx;
	}

	.appoint .app_index {
		width: 710rpx;
		margin: 20rpx;
		background: #fff;
		border-radius: 12rpx;
		padding: 10rpx 0;
	}

	.appoint .app_index .item {
		height: 90rpx;
		line-height: 90rpx;
		padding: 0 20rpx;
	}

	.appoint .app_index .item .but {
		width: 655rpx;
		height: 90rpx;
		background: #ffdd00;
		text-align: center;
		border-radius: 80rpx;
		margin-top: 30rpx;
		font-size: 36rpx;
		font-weight: bold;
	}

	.appoint .app_index .item .label {
		width: 190rpx;
		float: left;
	}

	.appoint .app_index .item .value {
		width: 480rpx;
		float: right;
		position: relative;
	}

	.appoint .app_index .item .type {
		width: 500rpx;
		text-align: center;
		float: left;
		height: 65rpx;
	}

	.appoint .app_index .item .type .select {
		width: 155rpx;
		height: 65rpx;
		line-height: 65rpx;
		margin-top: 20rpx;
		border: 1px solid #999ea4;
		border-radius: 40rpx;
		float: left;
	}

	.appoint .app_index .item .type .on {
		color: #ffaa19;
		border: 1px solid #ffaa19;
	}
</style>
